// 导入组件
import Vue from 'vue';
import Router from 'vue-router';
// 登录
import login from '@/views/login';
// 首页
import index from '@/views/index';


/**
 * 系统管理
 */
// 用户管理
import user from '@/views/sysConfig/user';
// 角色管理
import Role from '@/views/sysConfig/Role';
// 菜单管理
import Page from '@/views/sysConfig/Page';
// 项目管理
import Project from '@/views/sysConfig/Project';
// 定时任务
import SysTask from '@/views/sysConfig/sysTask';
/**
 * 接口管理
 */
//接口管理首页
import ApiIndex from "../views/apiTest/Api";
//用例管理
import TestCaseIndex from "../views/apiTest/TestCase";
import NewApi from "../views/apiTest/NewApi";
import TestSuite from "../views/apiTest/TestSuite";
import TestPlan from "../views/apiTest/TestPlan";
import Report from "../views/apiTest/Report";
import Client from "../views/publicConfig/GlobalParams";
import GlobalParams from "../views/publicConfig/GlobalParams";
import TestDatabase from "../views/publicConfig/TestDatabase";
import Flag from "../views/publicConfig/Flag";
import Env from "../views/publicConfig/Env";


// 启用路由
Vue.use(Router);

// 导出路由
export default new Router({
  routes: [{
    path: '/',
    name: '',
    component: login,
    hidden: true,
    meta: {
      requireAuth: false
    }
  }, {
    path: '/login',
    name: '登录',
    component: login,
    hidden: true,
    meta: {
      requireAuth: false
    }
  }, {
    path: '/index',
    name: '首页',
    component: index,
    iconCls: 'el-icon-tickets',
    children: [
      //系统管理模块
      //------------------------------------------------------------------------
      {
        path: '/sysConfig/User',
        name: '用户管理',
        component: user,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/sysConfig/Role/role',
        name: '角色管理',
        component: Role,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/sysConfig/Page',
        name: '菜单管理',
        component: Page,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/sysConfig/Project',
        name: '项目管理',
        component: Project,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/sysConfig/sysTask',
        name: '定时任务',
        component: SysTask,
        meta: {
          requireAuth: true
        }
      },
      //------------------------------------------------------------------------------
      //接口管理模块
      {
        path: '/apiTest/api/index',
        name: '接口管理',
        component: ApiIndex,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/apiTest/newApi/apiTabs',
        component: NewApi,
        meta: {requireAuth: true}
      },
      {
        path: '/apiTest/TestCase/index',
        name: '用例管理',
        component: TestCaseIndex,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/apiTest/TestSuite/index',
        name: '用例集管理',
        component: TestSuite,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/apiTest/testPlan/index',
        name: '执行计划',
        component: TestPlan,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/apiTest/report/index',
        name: '测试报告',
        component: Report,
        meta: {
          requireAuth: true
        }
      },
      //-----------------------------------------------------------------------------------------------------------
      //  公共配置
      {
        path: '/publicConfig/client/client',
        name: '执行机管理',
        component: Client,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/publicConfig/globalParams/globalParams',
        name: '公共参数',
        component: GlobalParams,
        meta: {
          requireAuth: true
        }

      },

      {
        path: '/publicConfig/testDatabase/testDatabase',
        name: '测试数据库',
        component: TestDatabase,
        meta: {
          requireAuth: true
        }
      },
      {
        path: '/publicConfig/flag/flag',
        name: '标签配置',
        component: Flag,
        meta: {
          requireAuth: true
        }
      }, {
        path: '/publicConfig/env/env',
        name: '环境配置',
        component: Env,
        meta: {
          requireAuth: true
        }
      }
    ]
  }]
})
